home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / LhaVCheck.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-26  |  3KB  |  131 lines

  1. /* VCheck.rexx */
  2. /*****************************************************************************
  3. SETUP:
  4.  
  5. To set up the ARexx Gadget Program Control set:
  6.     Check the following selections:
  7.         Skip selected directories
  8.         Skip selected files
  9.         Work without selected items
  10.         Skip .info files
  11.     Title string gadget
  12.         LhaVCheck (or whatever you wish to call it)
  13.     Path and Program name
  14.         Odds&ends:MegaD/rexx/LhaVCheck.rexx (or where ever you have it placed)
  15.  
  16. Add the new ARexx Gadget to a Keypad Gadget, Gadget Set Gadget or give 
  17. it a Hot Key definition so it may be called.
  18.  
  19. Once this is done you will need to modify these variables in this script:
  20.     LhaProgram = where your executable Lha is on your system
  21.     VCheckProgram = Where your executable Virus_Checker is on your system
  22.  
  23. USAGE:
  24.  
  25. Within MegaD, 
  26.     Open a directory window to the files you wish to unarc.
  27.     Open a directory window for where you wish to unarc the files to.
  28.     Make sure that the 'Dest'ination gadget is selected in the destination
  29.         window
  30.     Call LhaVCheck by use of the Gadget or Hot key you specified earlier.
  31. ******************************************************************************/
  32.  
  33. if ~show("L","rexxsupport.library") then call addlib"rexxsupport.library",0,-30
  34.  
  35. OPTIONS RESULTS
  36.  
  37. TRACE INTERMIDIATS
  38.  
  39. address MEGAD
  40. dbug TRUE
  41.  
  42.  
  43. /* change the following to where Lha is located on your system */
  44. LhaProgram = 'Odds&ends:commands/LHA'
  45.  
  46. VCheckProgram = 'Odds&ends:VCheck/Virus_Checker'
  47. VCheckPort    = 'Virus_Checker'
  48.  
  49. LhaGadgetName = 'LhaUnPackTemp'
  50.  
  51. /* get the active directory from MegaD */
  52. ActiveDir
  53. destDir = result
  54. IF destDir = "" THEN DO
  55.     call close 'STDOUT'
  56.     call open 'STDOUT','con:0/12/640/100/MegaD Error/SCREEN MEGAD', 'W'
  57.     SAY "No Destination directory returned from MegaD"
  58.     SAY "Exiting"
  59.     Call delay(300)
  60.     EXIT
  61.     END
  62.  
  63. /* create a User Gadget to call to unarc the the .lha files */
  64. AddProCtrl UserGadget "SkipDir|SkipInfo|ReloadDir" MDScreen Execute (LhaGadgetName) (LhaProgram) "'e'" NULL NULL NULL NULL NULL NULL NULL NULL
  65.  
  66. /* call the UserGadget */
  67. LhaGadgetName
  68.  
  69. /* we need to get a count of bytes in the Destination window to use for 
  70. a test later */
  71. /* There is no Select 'Dest'ination command the below 
  72.     becomes an equivalent though */
  73.  
  74.  
  75. DelProCtrl LhaGadgetName
  76.  
  77. /* make sure Virus Checker is running */
  78. IF ~SHOW("P",VCheckPort) THEN DO
  79.     ADDRESS COMMAND 'run ' || (VCheckProgram)
  80.     ADDRESS COMMAND 'WaitForPort ' || (VCheckPort)
  81.     END
  82.     
  83. /* 
  84.     We need a test to see when Lha is done, MegaD will update the 'Dest'ination 
  85.     directory once it exits.  By taking a count of the files in the 'Dest'ination
  86.     directory at start and then compairing it for a change we can tell when it is
  87.     time to go onto the next part of the script.
  88. */
  89.  
  90. ADDRESS MEGAD
  91. kill = 100 /* just incase Lha does not produce any files for us */
  92. SelectAll
  93. ClrSrc
  94. AllBytes
  95. startBytes = result
  96. endBytes = startBytes
  97. do while endBytes == startBytes
  98.     Call Delay(200)
  99.     SelectAll
  100.     ClrSrc
  101.     AllBytes
  102.     endBytes = result
  103.     kill = kill - 1
  104.     if kill = 0 then exit
  105.     END
  106.  
  107. /* leave all 'Dest'ination directory items selected */
  108. SelectAll
  109. ClrSrc
  110.  
  111. /* Get the path from the first selected item */
  112. NextItem Path
  113. destDir = result
  114.  
  115. if destDir = "" then do
  116.     call close 'STDOUT'
  117.     call open 'STDOUT','con:0/12/640/100/MegaD Error/SCREEN MEGAD', 'W'
  118.     SAY "could not get the 'Dest'ination directory"
  119.     SAY "Exiting"
  120.     Call delay(400)
  121.     EXIT
  122.     END
  123.     
  124. /* Clear all selected items */
  125. ClearAll
  126.  
  127. /* now talk to Virus Check */
  128. address (VCheckPort)
  129. 'checkdrive\' || destDir
  130.  
  131.